import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
import { IntlProvider } from 'react-intl'
import zhCN from "./locales/zh-CN.json";
import enUS from "./locales/en-US.json";

// messages 是一个对象，键是语言代码，值是对应语言的翻译文件
const messages: Record<string, any> = {
  'en-US': enUS,
  'zh-CN': zhCN,
}

const locale = navigator.language; // 获取浏览器语言

createRoot(document.getElementById('root')!).render(
  <IntlProvider
    messages={messages[locale]}
    locale={locale}
  >
    <App />
  </IntlProvider>
)
